package com.hotel.service;

import com.hotel.dao.YudingMapper;
import com.hotel.pojo.Yuding;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Date;
import java.util.ArrayList;

@Service
public class YudingServiceImpl implements YudingService {

    @Autowired
    YudingMapper YudingMapper;

    public int addYuding(Yuding yuding) {
        yuding.setReservationDate(new Date(System.currentTimeMillis()));
        return YudingMapper.addYuding(yuding);
    }

    public int deleteYudingById(int id) {
        return YudingMapper.deleteYudingById(id);
    }

    public int updateYudingById(Yuding yuding) {
        yuding.setReservationDate(new Date(System.currentTimeMillis()));
        return YudingMapper.updateYudingById(yuding);
    }

    public Yuding queryYudingById(int id) {
        return YudingMapper.queryYudingById(id);
    }

    public ArrayList<Yuding> queryAllYuding() {
        return YudingMapper.queryAllYuding();
    }

    public Yuding queryYudingByPhone(String phone) {
        return YudingMapper.queryYudingByPhone(phone);
    }
}
